package Text.Text1;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/*
 *@Student 张策
 */
public class text4 {
    public static void main(String[] args) {
        T4 t4 = new T4();
        t4.io();
    }
}
class T4{
    public void io(){
        byte[]bytes=new byte[8];
        int code;
        int len;
        String str="e:\\hello,word.txt";
        FileInputStream fileInputStream=null;
        try {
            fileInputStream = new FileInputStream(str);
//            while ((code=fileInputStream.read())!=-1){
//                System.out.println((char) code);
//            }
            while ((len=fileInputStream.read(bytes))!=-1){
                System.out.println(len);
                System.out.println(new String(bytes,0,len));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fileInputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
